package com.op.parcel.manage.config.security.authentication;

import com.op.parcel.common.api.R;
import com.op.parcel.manage.config.security.util.HttpDataUtil;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.Serializable;

/**
 * 认证过
 * @author xuan🐽
 */
@Component
public class EntryPoint implements AuthenticationEntryPoint, Serializable {
	@Override
	public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) {
		HttpDataUtil.respJson(response, R.error(e.getMessage()));
	}
}
